package com.hieu.sms.remote;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanFactory {
	private ApplicationContext context;
	
	private static BeanFactory instnace;
	
	private BeanFactory(){
		context = new ClassPathXmlApplicationContext(
				new String[] { "client-spring-context.xml" });
	}

	public static BeanFactory getInstnace() {
		if(instnace == null){
			instnace = new BeanFactory();
		}
		return instnace;
	}
	
	public <T> T getBean(String beanName, Class<T> cl){
		return context.getBean(beanName,cl);
	}
	
	
}
